//
//  MessageNoticeViewController.m
//  fxxiaoke
//
//  Created by 鞠超 on 16/9/12.
//  Copyright © 2016年 jc. All rights reserved.
//

#import "MessageNoticeViewController.h"

#import "MessageNoticeTableViewCell.h"

@interface MessageNoticeViewController () <UITableViewDelegate, UITableViewDataSource, UIScrollViewDelegate, UIPickerViewDataSource, UIPickerViewDelegate>

@property (nonatomic, strong) UITableView * tableView;

//行数
@property (nonatomic, assign) NSInteger rows_number;
@property (nonatomic, assign) NSInteger rows_tag;

//
@property (nonatomic, strong) UIView * view_bottom;
@property (nonatomic, strong) UIPickerView * pickerView;
@property (nonatomic, strong) UIButton * btn_ok;
@property (nonatomic, strong) UIButton * btn_cancel;
@property (nonatomic, strong) UILabel * lbl_selectTime;

@property (nonatomic, assign) NSInteger index_1;
@property (nonatomic, assign) NSInteger index_2;
@property (nonatomic, assign) NSInteger index_3;

@end

@implementation MessageNoticeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self p_navi];
    
    [self p_setupView];
    
    [self p_pickerView];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - navi
- (void )p_navi
{
    _btnLeft.hidden = YES;
    _lblLeft.hidden = YES;
    _btnRight.hidden = YES;
    _lblRight.hidden = YES;
    
    _lblTitle.text = @"新消息通知";
    
    //左返回
    UIImageView * image_LeftRetrun = [[UIImageView alloc] initWithFrame:CGRectMake(11, 31.5, 25, 25)];
    image_LeftRetrun.userInteractionEnabled = YES;
    image_LeftRetrun.image = [UIImage imageNamed:@"Left-return.png"];
    [_topView addSubview:image_LeftRetrun];
    
    UILabel * lbl_return = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(image_LeftRetrun.frame) - 6, 35, 35, 15)];
    lbl_return.text = @"设置";
    lbl_return.textColor = [UIColor whiteColor];
    lbl_return.font = [UIFont systemFontOfSize:17];
    [_topView addSubview:lbl_return];
    
    UIButton * btn_return = [UIButton buttonWithType:(UIButtonTypeSystem)];
    btn_return.frame = CGRectMake(10, 22, 60, 40);
    [_topView addSubview:btn_return];
    [btn_return addTarget:self action:@selector(btn_returnAction:) forControlEvents:(UIControlEventTouchUpInside)];
}

//左返回
- (void )btn_returnAction:(UIButton *)sender
{
    [self.navigationController popViewControllerAnimated:YES];
}

//tabbar
- (void )viewWillAppear:(BOOL)animated
{
    [(AppDelegate *)[[UIApplication sharedApplication] delegate] hiddenTabBar];
}

#pragma mark - 布局
- (void )p_setupView
{
    self.rows_number = 1;
    
    self.view.backgroundColor = [UIColor groupTableViewBackgroundColor];
    
    self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 64, SCREEN_WIDTH, SCREEN_HEIGHT - 64) style:(UITableViewStylePlain)];
    self.tableView.backgroundColor = [UIColor groupTableViewBackgroundColor];
    self.tableView.showsVerticalScrollIndicator = NO;
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.tableView.dataSource = self;
    self.tableView.delegate = self;
    self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, 100)];
    [self.view addSubview:self.tableView];
    
    //注册
    [self.tableView registerClass:[MessageNoticeTableViewCell class] forCellReuseIdentifier:@"message"];
}

#pragma mark - tableview代理
- (NSInteger )numberOfSectionsInTableView:(UITableView *)tableView
{
    return 3;
}

- (NSInteger )tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if(section == 0)
    {
        return 8;
    }
    else if(section == 1)
    {
        return self.rows_number;
    }
    else
    {
        return 1;
    }
}

- (CGFloat )tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if(indexPath.section == 0)
    {
        if(indexPath.row == 0)
        {
            return 10;
        }
        else if(indexPath.row == 2 || indexPath.row == 4)
        {
            if(SCREEN_WIDTH > 400)
            {
                return 35;
            }
            else
            {
                return 50;
            }
        }
        else if(indexPath.row == 7)
        {
            if(SCREEN_WIDTH > 350)
            {
                return 35;
            }
            else
            {
                return 50;
            }
        }
        else
        {
            return 50;
        }
    }
    else if(indexPath.section == 2)
    {
        if(SCREEN_WIDTH > 350)
        {
            return 35;
        }
        else
        {
            return 50;
        }
    }
    else
    {
        return 50;
    }
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    switch (indexPath.section)
    {
        case 0:
        {
            if(indexPath.row == 0)
            {
                UITableViewCell * cell = [[UITableViewCell alloc] init];
                cell.selectionStyle = UITableViewCellSelectionStyleNone;
                cell.backgroundColor = [UIColor groupTableViewBackgroundColor];
                
                return cell;
            }
            else if(indexPath.row == 1)
            {
                MessageNoticeTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"message" forIndexPath:indexPath];
                cell.selectionStyle = UITableViewCellSelectionStyleNone;
                cell.lbl_Opened.hidden = NO;
                
                cell.lbl_name.text = @"新消息通知";
                cell.lbl_Opened.text = @"已开启";
                
                return cell;
            }
            else if(indexPath.row == 2)
            {
                UITableViewCell * cell = [[UITableViewCell alloc] init];
                cell.selectionStyle = UITableViewCellSelectionStyleNone;
                cell.backgroundColor = [UIColor groupTableViewBackgroundColor];
                
                UILabel * lbl_detail = [[UILabel alloc] init];
                lbl_detail.frame = CGRectMake(15, 7, SCREEN_WIDTH - 30, 35);
                if(SCREEN_WIDTH > 400)
                {
                    lbl_detail.frame = CGRectMake(15, 7, SCREEN_WIDTH - 30, 15);
                }
                lbl_detail.text = @"请在iPhone的\"设置\"-\"通知\"功能中，找到应用程序\"智顺网络\"更改";
                lbl_detail.numberOfLines = 2;
                lbl_detail.textColor = [UIColor grayColor];
                lbl_detail.font = [UIFont systemFontOfSize:13];
                [cell addSubview:lbl_detail];
                
                return cell;
            }
            else if(indexPath.row == 3)
            {
                MessageNoticeTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"message" forIndexPath:indexPath];
                cell.selectionStyle = UITableViewCellSelectionStyleNone;
                cell.switch_right.hidden = NO;
                
                cell.lbl_name.text = @"通知显示信息详情";
                cell.switch_right.on = YES;
                cell.switch_right.tag = 200;
                [cell.switch_right addTarget:self action:@selector(switch_rightAction:) forControlEvents:(UIControlEventValueChanged)];
                return cell;
            }
            else if(indexPath.row == 4)
            {
                UITableViewCell * cell = [[UITableViewCell alloc] init];
                cell.selectionStyle = UITableViewCellSelectionStyleNone;
                cell.backgroundColor = [UIColor groupTableViewBackgroundColor];
                
                UILabel * lbl_detail = [[UILabel alloc] init];
                lbl_detail.frame = CGRectMake(15, 7, SCREEN_WIDTH - 30, 35);
                if(SCREEN_WIDTH > 400)
                {
                    lbl_detail.frame = CGRectMake(15, 7, SCREEN_WIDTH - 30, 15);
                }
                lbl_detail.text = @"关闭后，当收到消息时，通知提示将不再显示发信人和内容摘要。";
                lbl_detail.numberOfLines = 2;
                lbl_detail.textColor = [UIColor grayColor];
                lbl_detail.font = [UIFont systemFontOfSize:13];
                [cell addSubview:lbl_detail];
                
                return cell;
            }
            else if(indexPath.row == 5)
            {
                MessageNoticeTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"message" forIndexPath:indexPath];
                cell.selectionStyle = UITableViewCellSelectionStyleNone;
                cell.switch_right.hidden = NO;
                cell.view_Line.hidden = NO;
                
                cell.lbl_name.text = @"声音";
                cell.switch_right.on = YES;
                cell.switch_right.tag = 201;
                [cell.switch_right addTarget:self action:@selector(switch_rightAction:) forControlEvents:(UIControlEventValueChanged)];
                
                return cell;
            }
            else if(indexPath.row == 6)
            {
                MessageNoticeTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"message" forIndexPath:indexPath];
                cell.selectionStyle = UITableViewCellSelectionStyleNone;
                cell.switch_right.hidden = NO;
                
                cell.lbl_name.text = @"震动";
                cell.switch_right.on = NO;
                cell.switch_right.tag = 202;
                [cell.switch_right addTarget:self action:@selector(switch_rightAction:) forControlEvents:(UIControlEventValueChanged)];
                
                return cell;
            }
            else if(indexPath.row == 7)
            {
                UITableViewCell * cell = [[UITableViewCell alloc] init];
                cell.selectionStyle = UITableViewCellSelectionStyleNone;
                cell.backgroundColor = [UIColor groupTableViewBackgroundColor];
                
                UILabel * lbl_detail = [[UILabel alloc] init];
                lbl_detail.frame = CGRectMake(15, 7, SCREEN_WIDTH - 30, 35);
                if(SCREEN_WIDTH > 350)
                {
                    lbl_detail.frame = CGRectMake(15, 7, SCREEN_WIDTH - 30, 15);
                }
                lbl_detail.text = @"当纷享销客运行时，你可以设置是否需要声音和震动。";
                lbl_detail.numberOfLines = 2;
                lbl_detail.textColor = [UIColor grayColor];
                lbl_detail.font = [UIFont systemFontOfSize:13];
                [cell addSubview:lbl_detail];
                
                return cell;
            }
        }
            break;
        case 1:
        {
            if(self.rows_number == 1)
            {
                MessageNoticeTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"message" forIndexPath:indexPath];
                cell.selectionStyle = UITableViewCellSelectionStyleNone;
                cell.switch_right.hidden = NO;
                cell.view_Line.hidden = YES;
                cell.lbl_Opened.hidden = YES;
                
                cell.lbl_name.text = @"免打扰模式";
                cell.switch_right.on = NO;
                cell.switch_right.tag = 203;
                [cell.switch_right addTarget:self action:@selector(switch_rightAction:) forControlEvents:(UIControlEventValueChanged)];
                
                return cell;
            }
            else
            {
                if(indexPath.row == 0)
                {
                    MessageNoticeTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"message" forIndexPath:indexPath];
                    cell.selectionStyle = UITableViewCellSelectionStyleNone;
                    cell.switch_right.hidden = NO;
                    cell.view_Line.hidden = NO;
                    
                    cell.lbl_name.text = @"免打扰模式";
                    cell.switch_right.on = YES;
                    cell.switch_right.tag = 203;
                    [cell.switch_right addTarget:self action:@selector(switch_rightAction:) forControlEvents:(UIControlEventValueChanged)];
                    
                    return cell;
                }
                else if(indexPath.row == 1)
                {
                    MessageNoticeTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"message" forIndexPath:indexPath];
                    cell.selectionStyle = UITableViewCellSelectionStyleNone;
                    cell.lbl_Opened.hidden = NO;
                    cell.view_Line.hidden = NO;
                    cell.switch_right.hidden = YES;

                    cell.lbl_name.text = @"开始时间";
                    cell.lbl_Opened.text = @"23:00";
                    cell.lbl_Opened.tag = 500;
                    
                    return cell;
                }
                else if(indexPath.row == 2)
                {
                    MessageNoticeTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"message" forIndexPath:indexPath];
                    cell.selectionStyle = UITableViewCellSelectionStyleNone;
                    cell.lbl_Opened.hidden = NO;
                    cell.switch_right.hidden = YES;
                    
                    cell.lbl_name.text = @"结束时间";
                    cell.lbl_Opened.text = @"08:00";
                    cell.lbl_Opened.tag = 501;

                    return cell;
                }
            }
        }
            break;
        case 2:
        {
            UITableViewCell * cell = [[UITableViewCell alloc] init];
            cell.selectionStyle = UITableViewCellSelectionStyleNone;
            cell.backgroundColor = [UIColor groupTableViewBackgroundColor];
            
            UILabel * lbl_detail = [[UILabel alloc] init];
            lbl_detail.frame = CGRectMake(15, 7, SCREEN_WIDTH - 30, 35);
            if(SCREEN_WIDTH > 350)
            {
                lbl_detail.frame = CGRectMake(15, 7, SCREEN_WIDTH - 30, 15);
            }
            lbl_detail.text = @"开启后，在设定的时间范围内，手机不会震动与发出提示音";
            lbl_detail.numberOfLines = 2;
            lbl_detail.textColor = [UIColor grayColor];
            lbl_detail.font = [UIFont systemFontOfSize:13];
            [cell addSubview:lbl_detail];
            
            return cell;
        }
            break;
        default:
            break;
    }
    
    return nil;
}

- (void )tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if(self.rows_number == 3)
    {
        if(indexPath.section == 1)
        {
            if(indexPath.row == 1)
            {
                self.lbl_selectTime.text = @"选择开始时间";
                self.rows_tag = 500;
                
                [UIView animateWithDuration:0.5 animations:^{
                    
                    if(SCREEN_HEIGHT == 667)
                    {
                        self.tableView.contentOffset = CGPointMake(0, 300);
                    }
                    else if(SCREEN_HEIGHT == 480)
                    {
                        self.tableView.contentOffset = CGPointMake(0, 350);
                    }
                    else if(SCREEN_HEIGHT == 568)
                    {
                        self.tableView.contentOffset = CGPointMake(0, 300);
                    }
                    else if(SCREEN_HEIGHT == 736)
                    {
                        self.tableView.contentOffset = CGPointMake(0, 140);
                    }
                    
                    self.view_bottom.frame = CGRectMake(0, SCREEN_HEIGHT - 240, SCREEN_WIDTH, 240);
                }];
            }
            else if(indexPath.row == 2)
            {
                self.lbl_selectTime.text = @"选择结束时间";
                self.rows_tag = 501;

                [UIView animateWithDuration:0.5 animations:^{
                    
                    if(SCREEN_HEIGHT == 667)
                    {
                        self.tableView.contentOffset = CGPointMake(0, 300);
                    }
                    else if(SCREEN_HEIGHT == 480)
                    {
                        self.tableView.contentOffset = CGPointMake(0, 350);
                    }
                    else if(SCREEN_HEIGHT == 568)
                    {
                        self.tableView.contentOffset = CGPointMake(0, 300);
                    }
                    else if(SCREEN_HEIGHT == 736)
                    {
                        self.tableView.contentOffset = CGPointMake(0, 140);
                    }
                    
                    self.view_bottom.frame = CGRectMake(0, SCREEN_HEIGHT - 240, SCREEN_WIDTH, 240);
                }];
            }
        }
    }
}

#pragma mark - scrollView代理
- (void )scrollViewWillBeginDragging:(UIScrollView *)scrollView
{
    [UIView animateWithDuration:0.5 animations:^
    {
        self.view_bottom.frame = CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, 240);
    }];
}

#pragma mark - 点击滑块
- (void )switch_rightAction:(UISwitch *)sender
{
    switch (sender.tag - 200)
    {
        case 0:
        {
            UISwitch * switch_right = [self.view viewWithTag:200];
            
            if(switch_right.on == 0)
            {
                NSLog(@"关闭信息详情");
            }
            else
            {
                NSLog(@"开启信息详情");
            }
        }
            break;
        case 1:
        {
            UISwitch * switch_right = [self.view viewWithTag:201];
            
            if(switch_right.on == 0)
            {
                NSLog(@"关闭声音");
            }
            else
            {
                NSLog(@"开启声音");
            }
        }
            break;
        case 2:
        {
            UISwitch * switch_right = [self.view viewWithTag:202];
            
            if(switch_right.on == 0)
            {
                NSLog(@"关闭震动");
            }
            else
            {
                NSLog(@"开启震动");
            }
        }
            break;
        case 3:
        {
            if(self.rows_number == 1)
            {
                self.rows_number = 3;
            }
            else
            {
                self.rows_number = 1;
                
                [UIView animateWithDuration:0.5 animations:^{
                    
                    self.view_bottom.frame = CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, 240);
                }];
            }
            
            dispatch_async(dispatch_get_main_queue(), ^{
                //刷新tableView(记住,要更新放在主线程中)
                
                [self.tableView reloadData];
            });
        }
            break;
            
        default:
            break;
    }
}

#pragma mark - 时间选择器
- (void )p_pickerView
{
    self.view_bottom = [[UIView alloc] init];
    self.view_bottom.frame = CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, 240);
    self.view_bottom.backgroundColor = [UIColor groupTableViewBackgroundColor];
    [self.view addSubview:self.view_bottom];
    
    self.btn_cancel = [UIButton buttonWithType:(UIButtonTypeSystem)];
    self.btn_cancel.frame = CGRectMake(10, 5, 50, 30);
    [self.btn_cancel setTitle:@"取消" forState:(UIControlStateNormal)];
    [self.btn_cancel setTitleColor:[UIColor colorWithRed:46/255.0 green:115/255.0 blue:210/255.0 alpha:1.0] forState:(UIControlStateNormal)];
    self.btn_cancel.titleLabel.font = [UIFont systemFontOfSize:17];
    [self.view_bottom addSubview:self.btn_cancel];
    [self.btn_cancel addTarget:self action:@selector(btn_cancelAction:) forControlEvents:(UIControlEventTouchUpInside)];
    
    self.btn_ok = [UIButton buttonWithType:(UIButtonTypeSystem)];
    self.btn_ok.frame = CGRectMake(SCREEN_WIDTH - 60, 5, 50, 30);
    [self.btn_ok setTitle:@"确定" forState:(UIControlStateNormal)];
    [self.btn_ok setTitleColor:[UIColor colorWithRed:46/255.0 green:115/255.0 blue:210/255.0 alpha:1.0] forState:(UIControlStateNormal)];
    self.btn_ok.titleLabel.font = [UIFont systemFontOfSize:17];
    [self.view_bottom addSubview:self.btn_ok];
    [self.btn_ok addTarget:self action:@selector(btn_okAction:) forControlEvents:(UIControlEventTouchUpInside)];
    
    self.lbl_selectTime = [[UILabel alloc] initWithFrame:CGRectMake(SCREEN_WIDTH / 2 - 75, 10, 150, 20)];
    self.lbl_selectTime.font = [UIFont systemFontOfSize:16.0f];
    self.lbl_selectTime.textAlignment = NSTextAlignmentCenter;
    self.lbl_selectTime.textColor = navi_bar_bg_color;
    [self.view_bottom addSubview:self.lbl_selectTime];
    
    //
    self.pickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0, 40, SCREEN_WIDTH, 200)];
    self.pickerView.delegate = self;
    self.pickerView.dataSource = self;
    self.pickerView.backgroundColor = [UIColor whiteColor];
    [self.view_bottom addSubview:self.pickerView];
}

#pragma mark - 点击取消和确定
- (void )btn_cancelAction:(UIButton *)sender
{
//    NSLog(@"收回时间选择器");
    
    [UIView animateWithDuration:0.5 animations:^{
        
        if(SCREEN_HEIGHT == 667)
        {
            self.tableView.contentOffset = CGPointMake(0, 0);
        }
        else if(SCREEN_HEIGHT == 480)
        {
            self.tableView.contentOffset = CGPointMake(0, 200);
        }
        else if(SCREEN_HEIGHT == 568)
        {
            self.tableView.contentOffset = CGPointMake(0, 150);
        }
        else if(SCREEN_HEIGHT == 736)
        {
            self.tableView.contentOffset = CGPointMake(0, 0);
        }
        
        self.view_bottom.frame = CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, 240);
    }];
}

- (void )btn_okAction:(UIButton *)sender
{
//    NSLog(@"记录选择的时间并收回时间选择器");
    
    NSArray * arr_2 = @[@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9",@"10",@"11",@"12"];
    NSArray * arr_3 = @[@"00",@"01",@"02",@"03",@"04",@"05",@"06",@"07",@"08",@"09",@"10",@"11",@"12",@"13",@"14",@"15",@"16",@"17",@"18",@"19",@"20",@"21",@"22",@"23",@"24",@"25",@"26",@"27",@"28",@"29",@"30",@"31",@"32",@"33",@"34",@"35",@"36",@"37",@"38",@"39",@"40",@"41",@"42",@"43",@"44",@"45",@"46",@"47",@"48",@"49",@"50",@"51",@"52",@"53",@"54",@"55",@"56",@"57",@"58",@"59"];
    
    UILabel * lbl_time = [self.view viewWithTag:self.rows_tag];
    if(self.index_1 == 0)
    {
        lbl_time.text = [NSString stringWithFormat:@"%02ld:%@",[arr_2[self.index_2] integerValue],arr_3[self.index_3]];
        
        if([arr_2[self.index_2] isEqualToString:@"12"])
        {
            lbl_time.text = [NSString stringWithFormat:@"00:%@",arr_3[self.index_3]];
        }
    }
    else
    {
        lbl_time.text = [NSString stringWithFormat:@"%02ld:%@",[arr_2[self.index_2] integerValue] + 12,arr_3[self.index_3]];
        
        if([arr_2[self.index_2] isEqualToString:@"12"])
        {
            lbl_time.text = [NSString stringWithFormat:@"12:%@",arr_3[self.index_3]];
        }
    }
    
    [UIView animateWithDuration:0.5 animations:^{
        
        if(SCREEN_HEIGHT == 667)
        {
            self.tableView.contentOffset = CGPointMake(0, 0);
        }
        else if(SCREEN_HEIGHT == 480)
        {
            self.tableView.contentOffset = CGPointMake(0, 200);
        }
        else if(SCREEN_HEIGHT == 568)
        {
            self.tableView.contentOffset = CGPointMake(0, 150);
        }
        else if(SCREEN_HEIGHT == 736)
        {
            self.tableView.contentOffset = CGPointMake(0, 0);
        }
        
        self.view_bottom.frame = CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, 240);
    }];
}

#pragma mark - UIPickerView代理
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
    return 3;
}

- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
{
    switch (component)
    {
        case 0:
            return 2;
            break;
        case 1:
            return 12;
            break;
        case 2:
            return 60;
            break;
        default:
            return 0;
            break;
    }
}

- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{
    NSArray * arr_1 = @[@"上午",@"下午"];
    NSArray * arr_2 = @[@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9",@"10",@"11",@"12"];
    NSArray * arr_3 = @[@"00",@"01",@"02",@"03",@"04",@"05",@"06",@"07",@"08",@"09",@"10",@"11",@"12",@"13",@"14",@"15",@"16",@"17",@"18",@"19",@"20",@"21",@"22",@"23",@"24",@"25",@"26",@"27",@"28",@"29",@"30",@"31",@"32",@"33",@"34",@"35",@"36",@"37",@"38",@"39",@"40",@"41",@"42",@"43",@"44",@"45",@"46",@"47",@"48",@"49",@"50",@"51",@"52",@"53",@"54",@"55",@"56",@"57",@"58",@"59"];

    switch (component)
    {
        case 0:
            return arr_1[row];
            break;
        case 1:
            return arr_2[row];
            break;
        case 2:
            return arr_3[row];
            break;
        default:
            break;
    }
    
    return nil;
}

- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
    switch (component)
    {
        case 0:
        {
            self.index_1 = row;
        }
            break;
        case 1:
        {
            self.index_2 = row;
        }
            break;
        case 2:
        {
            self.index_3 = row;
        }
            break;
        default:
            break;
    }
}

@end

//    if(indexPath.row == 0)
//    {
//        UITableViewCell * cell = [[UITableViewCell alloc] init];
//        cell.selectionStyle = UITableViewCellSelectionStyleNone;
//        cell.backgroundColor = [UIColor groupTableViewBackgroundColor];
//
//        return cell;
//    }
//    else if(indexPath.row == 1)
//    {
//        MessageNoticeTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"message" forIndexPath:indexPath];
//        cell.selectionStyle = UITableViewCellSelectionStyleNone;
//        cell.lbl_Opened.hidden = NO;
//
//        cell.lbl_name.text = @"新消息通知";
//        cell.lbl_Opened.text = @"已开启";
//
//        return cell;
//    }
//    else if(indexPath.row == 2)
//    {
//        UITableViewCell * cell = [[UITableViewCell alloc] init];
//        cell.selectionStyle = UITableViewCellSelectionStyleNone;
//        cell.backgroundColor = [UIColor groupTableViewBackgroundColor];
//
//        UILabel * lbl_detail = [[UILabel alloc] init];
//        lbl_detail.frame = CGRectMake(15, 7, SCREEN_WIDTH - 30, 35);
//        if(SCREEN_WIDTH > 400)
//        {
//            lbl_detail.frame = CGRectMake(15, 7, SCREEN_WIDTH - 30, 15);
//        }
//        lbl_detail.text = @"请在iPhone的\"设置\"-\"通知\"功能中，找到应用程序\"智顺网络\"更改";
//        lbl_detail.numberOfLines = 2;
//        lbl_detail.textColor = [UIColor grayColor];
//        lbl_detail.font = [UIFont systemFontOfSize:13];
//        [cell addSubview:lbl_detail];
//
//        return cell;
//    }
//    else if(indexPath.row == 3)
//    {
//        MessageNoticeTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"message" forIndexPath:indexPath];
//        cell.selectionStyle = UITableViewCellSelectionStyleNone;
//        cell.switch_right.hidden = NO;
//
//        cell.lbl_name.text = @"通知显示信息详情";
//        cell.switch_right.on = YES;
//
//        return cell;
//    }
//    else if(indexPath.row == 4)
//    {
//        UITableViewCell * cell = [[UITableViewCell alloc] init];
//        cell.selectionStyle = UITableViewCellSelectionStyleNone;
//        cell.backgroundColor = [UIColor groupTableViewBackgroundColor];
//
//        UILabel * lbl_detail = [[UILabel alloc] init];
//        lbl_detail.frame = CGRectMake(15, 7, SCREEN_WIDTH - 30, 35);
//        if(SCREEN_WIDTH > 400)
//        {
//            lbl_detail.frame = CGRectMake(15, 7, SCREEN_WIDTH - 30, 15);
//        }
//        lbl_detail.text = @"关闭后，当收到消息时，通知提示将不再显示发信人和内容摘要。";
//        lbl_detail.numberOfLines = 2;
//        lbl_detail.textColor = [UIColor grayColor];
//        lbl_detail.font = [UIFont systemFontOfSize:13];
//        [cell addSubview:lbl_detail];
//
//        return cell;
//    }
//    else if(indexPath.row == 5)
//    {
//        MessageNoticeTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"message" forIndexPath:indexPath];
//        cell.selectionStyle = UITableViewCellSelectionStyleNone;
//        cell.switch_right.hidden = NO;
//        cell.view_Line.hidden = NO;
//
//        cell.lbl_name.text = @"声音";
//        cell.switch_right.on = YES;
//
//        return cell;
//    }
//    else if(indexPath.row == 6)
//    {
//        MessageNoticeTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"message" forIndexPath:indexPath];
//        cell.selectionStyle = UITableViewCellSelectionStyleNone;
//        cell.switch_right.hidden = NO;
//
//        cell.lbl_name.text = @"震动";
//        cell.switch_right.on = NO;
//
//        return cell;
//    }
//    else if(indexPath.row == 7)
//    {
//        UITableViewCell * cell = [[UITableViewCell alloc] init];
//        cell.selectionStyle = UITableViewCellSelectionStyleNone;
//        cell.backgroundColor = [UIColor groupTableViewBackgroundColor];
//
//        UILabel * lbl_detail = [[UILabel alloc] init];
//        lbl_detail.frame = CGRectMake(15, 7, SCREEN_WIDTH - 30, 35);
//        if(SCREEN_WIDTH > 350)
//        {
//            lbl_detail.frame = CGRectMake(15, 7, SCREEN_WIDTH - 30, 15);
//        }
//        lbl_detail.text = @"当纷享销客运行时，你可以设置是否需要声音和震动。";
//        lbl_detail.numberOfLines = 2;
//        lbl_detail.textColor = [UIColor grayColor];
//        lbl_detail.font = [UIFont systemFontOfSize:13];
//        [cell addSubview:lbl_detail];
//
//        return cell;
//    }
//    else if(indexPath.row == 8)
//    {
//        MessageNoticeTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"message" forIndexPath:indexPath];
//        cell.selectionStyle = UITableViewCellSelectionStyleNone;
//        cell.switch_right.hidden = NO;
//
//        cell.lbl_name.text = @"免打扰模式";
//        cell.switch_right.on = NO;
//
//        return cell;
//    }
//    else if(indexPath.row == 9)
//    {
//        UITableViewCell * cell = [[UITableViewCell alloc] init];
//        cell.selectionStyle = UITableViewCellSelectionStyleNone;
//        cell.backgroundColor = [UIColor groupTableViewBackgroundColor];
//
//        UILabel * lbl_detail = [[UILabel alloc] init];
//        lbl_detail.frame = CGRectMake(15, 7, SCREEN_WIDTH - 30, 35);
//        if(SCREEN_WIDTH > 350)
//        {
//            lbl_detail.frame = CGRectMake(15, 7, SCREEN_WIDTH - 30, 15);
//        }
//        lbl_detail.text = @"开启后，在设定的时间范围内，手机不会震动与发出提示音";
//        lbl_detail.numberOfLines = 2;
//        lbl_detail.textColor = [UIColor grayColor];
//        lbl_detail.font = [UIFont systemFontOfSize:13];
//        [cell addSubview:lbl_detail];
//
//        return cell;
//    }
//    else
//    {
//        UITableViewCell * cell = [[UITableViewCell alloc] init];
//
//        return cell;
//    }

